package net.mrsigma.tetris.entitles;

import net.mrsigma.tetris.listener.ShapeListener;

public class Shape {
	
	private ShapeListener listener;
	
	public void moveLeft() {
		System.out.println("shape's moveLeft");
	}
	public void moveRight() {
		System.out.println("shape's move Right");
	}
	public void moveDown() {
		System.out.println("shape's moveDown");
	}
	public void rotate() {
		System.out.println("shape's rotate");
	}
	public void drawMe() {
		System.out.println("shape's drawMe");
	}
	private class ShapeDriver implements Runnable {

		@Override
		public void run() {
			// TODO Auto-generated method stub
			while(true) {
				moveDown();
				listener.shapeMoveDown(Shape.this);
				try {
					Thread.sleep(1000);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}
		
	}
	public Shape() {
		new Thread(new ShapeDriver()).start();
	}
	
	public void addShapeListener(ShapeListener l) {
		if (l != null)
			this.listener = l;
	}
}
